package com.inspur.controller;

import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.inspur.pojo.Manager;
import com.inspur.service.ManagerService;


@Controller
public class LoginController {
	@Autowired
	private ManagerService managerService;
	
	@RequestMapping("loginController")
	public ModelAndView login(String managerid,String manpassword){
		ModelAndView mv = new ModelAndView();
		HashMap map = new HashMap<String, String>();
		map.put("managerid", managerid);
		map.put("manpassword", manpassword);
		Manager manager = managerService.getManagerLogin(map);
		if(manager !=null){
			mv.setViewName("mainindex.jsp");
		}else{
			mv.setViewName("login.jsp");
			mv.addObject("message", "教务号或密码错误，请重新输入");
		}
		return mv;
	}

}
